package com.gitee.aurora.core.rule;

import org.springframework.util.ObjectUtils;

public class VerificationRules {

    public static boolean notEmpty(Object source, String s) {
        return !ObjectUtils.isEmpty(source);
    }

    public static boolean prefixChar(Object source,String pre) {
        String argStr = source.toString();
        return argStr.startsWith(pre);
    }

    public static boolean charLength(Object source,String length) {
        String argStr = source.toString();
        return Integer.parseInt(length) == argStr.length();
    }

    public static boolean onlyChar(Object source,String onlyChar) {
        return source.toString().equals(onlyChar);
    }
}
